# age = 18
# name = 'tome'
# weight = 75.5

# print('我的名字是%s, 今年%s岁了, 体重%s公斤' % (name, age, weight))

# print(f'我的名字是{name}, 今年{age}岁了, 体重{weight}公斤')

# 转义字符
'''
print('hello world', end='\n')
print('python', end='...')
print('python')
'''

# 输入
'''
a = input("")
print(type(a))
print(type(float(a)))
print("%.3f" % float(a))

str = '[1,2,3]'
print(eval(str))
print(type(eval(str)))
'''

# 条件语句

'''
age = int(input("请输入您的年龄"))

if age < 18:
    print(f'您的年龄{age}岁，不可以参加工作')
elif 18 <= age <= 60:
    print(f'您的年龄是{age}岁，可以参加工作')
    if 20 <= age <= 30:
        print(f'您的年龄是{age}岁，这是黄金年龄，请努力工作')
else:
    print(f'您的年龄是{age}岁，您可以退休了')

a, b = 1, 2
c = a if a < b else b
print(c)
'''

# 循环语句
'''
i = 2
sum = 0
while i <= 100:
    sum += i
    i += 2
print(sum)


i = 1
while i <= 9:
    j = 1
    while j <= i:
        print(f'{j}*{i}={i*j}', end="\t")
        j += 1
    i += 1
    print()

str1 = 'hello'
for i in str1:
    if i == 'l':
        continue
    print(i, end="\t")
else:
    print("执行了else")
'''

# 字符串
'''
str1 = 'abcbcdefg'
print(str1[-4:-1:1])

print(str1.find('bcr', 2, 9))
print(str1.count('bc', 2, 11))

split = str1.split("bc")
print(split)
'''

# 列表  可修改

'''
name_list = ['叶文杰', 'lily', 'rose']
name = input("请输入姓名：")
if name in name_list:
    print("姓名正确")
else:
    print("姓名不存在, 但是已经添加到数据库中")
    name_list.insert(5, name)
print(name_list)
print(name_list[5])

name_list = ['叶文杰', 'lily', 'rose']

for name in name_list:
    print(name)

i = 0
while i < len(name_list):
    print(name_list[i])
    i += 1

name_list = [['tom', 'rose', 'lili'], ['小明', '小红', "小白"], ['yu', 'po', 'lk']]
print(name_list[0][2])
'''

# 元组 不可修改

'''
t2 = (20,) # 元组只有一个数据，也需要又逗号
t1 = (10, 20, 30, 20, [10, 20, 30])
print(type(t1))
print(t1)
print(type(t2))
print(t1.index(30))
print(t1.count(20))
print(len(t1))
print(t1[4])
t1[4][0] = 0
print(t1)
'''

# 字典  可修改

'''
dict1 = {'name':'Tom', 'age':20, 'gender':'男'}
print(dict1)
dict2, dict3 = {}, dict()
print(dict2)
print(dict3)
print(type(dict2))
print(type(dict3))
dict2['school'] = '兰溪五中'
print(dict2)
dict2['school'] = '内科大'
print(dict2)

print(dict1.get('name'))
print(dict1.get('names', "lili"))
print(dict1.get('id'))

print(dict1.keys())

print(dict1.values())

print(dict1.items())
print(type(dict1.items()))

for key in dict1.keys():
    print(f'{key}')
for value in dict1.values():
    print(value)
    print(type(value))
for item in dict1.items():
    print(item)
    print(type(item))
for key, value in dict1.items():
    print(f'{key} = {value}')
'''

# 集合 会对数据进行去重 不可变

'''
set1 = {10, 20, 30, 40, 50, 10, 30}
print(set1)

s2 = {10, 30, 20, 40, 30, 20}
print(s2)

s3 = set("abcdefg")
print(s3)

s4 = set()
s5 = {}
print(type(s4))
print(type(s5))

set1.add(500)
print(set1)

s3.update("hijk")
print(s3)
'''

# 公共操作

'''
str1 = 'aa'
str2 = 'bb'
print((str1 + str2))

list1 = [1, 2]
list2 = [3, 4]
print(list1 + list2)

t1 = (1, 2)
t2 = (3, 4)
print(t1 + t2)

print((str1 * 5))
print((list1 * 3))
print((t1 * 3))

print('a' in str1)
print('a' not in str1)
print(1 in list1)
print(1 not in list1)
print(1 in t1)
print(1 not in t1)

del str1
print(str1)

print(range(5))
for i in range(0, 10, 2):
    print(i, end=",")


list1 = ['a', 'b', 'c', 'd', 'e', 'f']

for i in enumerate(list1):
    print(i)

for i in enumerate(list1, start=2):
    print(i)
'''

# 推导式
'''
list1 = []
i = 0
while i < 10:
    list1.append(i)
    i += 1
print(list1)

列表推导式
list2 = [i for i in range(10)]
print(list2)

list1 = [i for i in range(0, 10, 2)]
print(list1)

list2 = [i for i in range(10) if i % 2 == 0]
print(list2)

list3 = [(i, j) for i in range(1, 3) for j in range(3)]
print(list3)

list1 = ['name', 'age', 'gender']
list2 = ['tom', 20, '男']
dict1 = {list1[i]:list2[i] for i in range(len(list1))}
print(dict1)

字典推导式
counts = {'MBP':268, 'HP':125, 'DELL':201, 'Lenovo':199, 'acer':99}
count1 = {key:value for key,value in counts.items() if value >= 200}
print(count1)
'''


